Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-merge-rules

Package Overview
Dependencies
Maintainers
2
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-merge-rules

Merge CSS rules with PostCSS.

  • 1.3.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.3M
decreased by-28.02%
Maintainers
2
Weekly downloads
 
Created

What is postcss-merge-rules?

The postcss-merge-rules npm package is designed to optimize CSS by merging CSS rules with identical selectors or declarations. This can lead to smaller CSS files and potentially faster load times for web pages.

What are postcss-merge-rules's main functionalities?

Merging based on identical selectors

This feature combines rules with identical selectors into a single rule. In the code sample, two rules for the 'a' selector are merged into one.

const postcss = require('postcss');
const mergeRules = require('postcss-merge-rules');

const css = `a { color: blue; }
a { font-size: 14px; }`;

postcss([mergeRules()])
.process(css, { from: undefined })
.then(result => console.log(result.css));

Merging based on identical declarations

This feature merges rules that have identical declarations but different selectors, creating a grouped selector. The code sample demonstrates merging two rules that apply the same color declaration to different selectors.

const postcss = require('postcss');
const mergeRules = require('postcss-merge-rules');

const css = `a { color: blue; }
b { color: blue; }`;

postcss([mergeRules()])
.process(css, { from: undefined })
.then(result => console.log(result.css));

Other packages similar to postcss-merge-rules

Keywords

FAQs

Package last updated on 01 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc